package com.dk.jwzx.reptile.student;

import com.dk.jwzx.bean.Student;
import com.dk.jwzx.reptile.ReptileBase;
import com.dk.util.EncodeUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class CquptStudentReptile extends ReptileBase {

    @Override
    public Student doCrawling(String json) {
        String data=json.split("\\[")[1];
        String studentJson=EncodeUtil.unicodeToChinese(data.substring(0,data.lastIndexOf("]}")));

        //System.out.println(json);
        Student student=null;
        ObjectMapper mapper=new ObjectMapper();
        try {
            student=mapper.readValue(studentJson,Student.class);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return student;
    }
}
